package ws.jdbc.concurrent.test.tasks.read;

import java.sql.ResultSet;
import java.sql.SQLException;
import ws.jdbc.concurrent.eresultset.EResultSet;
import ws.jdbc.concurrent.exception.JdbcConcurrentException;
import ws.jdbc.concurrent.test.tasks.CursorRunnable;

/**
 * This task reads data from a {@link ResultSet} using an {@link EResultSet}.
 * 
 * @author Wilson Santos, 36228 <wilson.santos@ua.pt>
 */
public class CursorRead extends CursorRunnable {

  public CursorRead() throws SQLException, JdbcConcurrentException {
    super();
  }

  public void run() {
    try {
      while (cursor.next()) {
        num = cursor.getInt(1);
        str1 = cursor.getString(2);
        str2 = cursor.getString(3);
        decimal = cursor.getFloat(4);
      }
    } catch (SQLException ex) {
      ex.printStackTrace();
    }
  }
}
